<%@ page import="Contas.Administrador" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
       <meta name="layout" content="adminContas" />
        <g:set var="entityName" value="${message(code: 'administrador.label', default: 'Administrador')}" />
        <title><g:message code="SPL - Editando Administrador" args="[entityName]" /></title>
    </head>
    <body>
       
        <div class="body">
            <h1><g:message code="Preencha os campos abaixo" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${administradorInstance}">
            <div class="errors">
                <g:renderErrors bean="${administradorInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${administradorInstance?.id}" />
                <g:hiddenField name="version" value="${administradorInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>                      
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="senha"><g:message code="administrador.senha.label" default="Senha" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: administradorInstance, field: 'passwd', 'errors')}">
                                    <g:passwordField name="senha" value="${administradorInstance?.passwd}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="email"><g:message code="administrador.email.label" default="Email" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: administradorInstance, field: 'email', 'errors')}">
                                    <g:textField name="email" maxlength="50" value="${administradorInstance?.email}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="telefone"><g:message code="administrador.telefone.label" default="Telefone" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: administradorInstance, field: 'telefone', 'errors')}">
                                     <g:textField size="2" name="ddd" maxlength="2" value="${telefoneInstance?.ddd}" />
                                    <g:textField size="4" name="telefoneParte1" maxlength="4" value="${telefoneInstance?.telefoneParte1}" />
                                    <g:textField size="4" name="telefoneParte2" maxlength="4" value="${telefoneInstance?.telefoneParte2}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="nome"><g:message code="administrador.nome.label" default="Nome" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: administradorInstance, field: 'userRealName', 'errors')}">
                                    <g:textField name="nome" maxlength="50" value="${administradorInstance?.userRealName}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="tipo"><g:message code="administrador.tipo.label" default="Tipo" /></label>
                                </td>
                                <td valign="top" class="name">
                                    <g:select id="tipo" name="tipo" default="Tipo" noSelection="${['Novo Tipo':message(code:'Novo Tipo')]}" from="${tiposAdmin}" value="${administradorInstance?.tipo}"/>
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="tipo"><g:message code="administrador.tipo.label" default="Novo Tipo" /></label>
                                </td>
                             	<td valign="top" class="value ${hasErrors(bean: administradorInstance, field: 'tipo', 'errors')}">
                             		<g:textField name="tipo" value="${administradorInstance?.tipo}"/>
                                </td>
                            </tr>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value='Atualizar' onclick="return confirm('Tem certeza que deseja completar essa atualizacao?');" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value='Remover' onclick="return confirm('Tem certeza que deseja remover este usuario?');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
